package com.huawei.appmarket.service.settings.view.widget;

import android.content.Context;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.RadioButton;
import android.widget.RelativeLayout;
import android.widget.TextView;
import o.azb;
import o.der.d;
import o.der.g;
import o.Logger;
import o.epv;
import o.NetWorkUtil;

public class VerticalRadioView extends RelativeLayout {
    private View ˊ;
    private RadioButton ˋ;
    private TextView ˎ;
    private TextView ˏ;
    private RelativeLayout ॱ;

    public VerticalRadioView(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        ॱ(context, attributeSet);
    }

    public VerticalRadioView(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        ॱ(context, attributeSet);
    }

    private void ॱ(Context context, AttributeSet attributeSet) {
        ((LayoutInflater) context.getSystemService("layout_inflater")).inflate(g.ꜟ, this);
        azb.ˏ(this, d.ॱﹳ);
        this.ˎ = (TextView) findViewWithTag("title");
        this.ˏ = (TextView) findViewWithTag("content");
        this.ˋ = (RadioButton) findViewWithTag("radionbutton");
        this.ॱ = (RelativeLayout) findViewById(d.ʳ);
        this.ˊ = findViewWithTag("divider");
        azb.ˋ(this.ˊ);
        CharSequence ˋ = ˋ(context, attributeSet, "title");
        String ˋ2 = ˋ(context, attributeSet, "text");
        if (this.ˏ != null) {
            this.ˏ.setText(NetWorkUtil.rebuildWifiKey(ˋ2));
            if (ˋ2 == null || ˋ2.trim().isEmpty()) {
                if (this.ॱ != null) {
                    this.ॱ.setMinimumHeight(epv.ˋ(getContext(), 48));
                }
                this.ˏ.setVisibility(8);
            } else if (this.ॱ != null) {
                this.ॱ.setMinimumHeight(epv.ˋ(getContext(), 64));
            }
        }
        if (this.ˎ != null) {
            this.ˎ.setText(ˋ);
            setOnClickListener(new OnClickListener(this) {
                final /* synthetic */ VerticalRadioView ˎ;

                {
                    this.ˎ = r1;
                }

                public void onClick(View view) {
                    if (this.ˎ.ˋ != null && this.ˎ.ˋ.isEnabled()) {
                        this.ˎ.ˋ.toggle();
                    }
                }
            });
        }
    }

    private String ˋ(Context context, AttributeSet attributeSet, String str) {
        if (attributeSet == null) {
            return "";
        }
        String attributeValue = attributeSet.getAttributeValue("http://schemas.android.com/apk/res/android", str);
        if (TextUtils.isEmpty(attributeValue) || !attributeValue.startsWith("@")) {
            return attributeValue;
        }
        try {
            return context.getString(Integer.parseInt(attributeValue.substring(1)));
        } catch (Exception e) {
            Logger.e("VerticalRadioView", "getAttributeString(...) " + e.toString());
            return attributeValue;
        }
    }

    public void setTitle(CharSequence charSequence) {
        this.ˎ.setText(charSequence);
    }

    public void setContent(CharSequence charSequence) {
        if (charSequence == null || charSequence.toString().trim().isEmpty()) {
            this.ˏ.setVisibility(8);
            if (this.ॱ != null) {
                this.ॱ.setMinimumHeight(epv.ˋ(getContext(), 48));
                return;
            }
            return;
        }
        this.ˏ.setText(NetWorkUtil.rebuildWifiKey(charSequence.toString()));
        if (this.ॱ != null) {
            this.ॱ.setMinimumHeight(epv.ˋ(getContext(), 64));
        }
    }

    public void setDividerVisibility(int i) {
        if (this.ˊ != null) {
            this.ˊ.setVisibility(i);
        }
    }

    public void setEnable(boolean z) {
        setClickable(z);
        this.ˋ.setEnabled(z);
        this.ˋ.setClickable(z);
    }

    public RadioButton ˊ() {
        return this.ˋ;
    }
}
